package com.aloha.boot02.controller;

import com.aloha.boot02.config.IConfig;
import com.aloha.boot02.config.prop.DataBaseProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author DaiZhiHeng
 * @date 2023/10/2 21:20
 */
@RestController
public class HelloController {

    @Resource
    private IConfig config;

    @GetMapping("/info")
    public String getInfo() {
        return config.getInfo();
    }


    @Resource
    private DataBaseProperties properties;

    @GetMapping("/db")
    public Map<String, Object> getDbInfo() {
        Map<String, Object> ans = new HashMap<>();
        ans.put("mysql", properties.getMysql());
        ans.put("redis", properties.getRedis());
        return ans;
    }
}
